home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 7 / 007.d81 / dos #17 < prev    next >
Text File  |  2022-08-26  |  3KB  |  165 lines

  1.       DOS AND DON'TS -- Part 17
  2.       {CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}
  3.  
  4.  
  5.  
  6.   Now you want to know how to get data
  7.  
  8. off of the disk.  Well this is done
  9.  
  10. with the U1 command.  The process is
  11.  
  12. almost exactly opposite of putting
  13.  
  14. data onto the disk.
  15.  
  16.   As usual, we have to OPEN two
  17.  
  18. channels -- one to send commands and
  19.  
  20. one to RECEIVE the data.  We can use
  21.  
  22. the same OPEN statements as before for
  23.  
  24. this.
  25.  
  26.   After we have our files open, all
  27.  
  28. we have to do is decide where we are
  29.  
  30. going to get our data from.  Now this
  31.  
  32. can be any legal track and sector.
  33.  
  34. Check the first table in this article
  35.  
  36. for more info. on tracks and sectors.
  37.  
  38. Most people will develop their own
  39.  
  40. schemes for saving their data on the
  41.  
  42. disk and the READING process will be
  43.  
  44. according to this layout.
  45.  
  46.   After we have decided where to get
  47.  
  48. the data from we must tell the
  49.  
  50. computer to go to the disk drive and
  51.  
  52. get it.  This is done with the U1
  53.  
  54. command.  The syntax of the U1 command
  55.  
  56. is the same as that of the U2 command.
  57.  
  58. We must tell the U1 command what
  59.  
  60. channel to PUT the data into, what
  61.  
  62. drive to access, and what track and
  63.  
  64. sector to get the data from.
  65.  
  66.   After the U1 command is executed,
  67.  
  68. data from that particular block and
  69.  
  70. sector will be contained in the buffer
  71.  
  72. specified.  All you have to do then is
  73.  
  74. GET the data from that buffer.  This
  75.  
  76. is acomplished with the GET# command.
  77.  
  78.   A short example of all of this is
  79.  
  80. shown below.  It is assumed that the
  81.  
  82. data we want is on track 10, and
  83.  
  84. sector 15 since this is where we tried
  85.  
  86. to put our data is the above examples.
  87.  
  88.  
  89.  10 OPEN15,8,15
  90.  20 OPEN2,8,2,"#"
  91.  30 :
  92.  40 TR=10 : SE=15
  93.  50 :
  94.  60 PRINT#15,"U1:"2;0;TR;SE
  95.  70 :
  96.  80 FOR X = 1 TO 255
  97.  90 GET#2,A$
  98. 100 PRINT A$;
  99. 110 NEXT X
  100. 120 :
  101. 130 CLOSE2:CLOSE15
  102. 140 END
  103.  
  104.  
  105.   This example reads in the data on
  106.  
  107. track 10, sector 15 and then prints
  108.  
  109. the data to the screen.  You could
  110.  
  111. of course, save the data in an array
  112.  
  113. or however you would like to store it.
  114.  
  115.   As added examples there are two
  116.  
  117. programs included on this disk.  One
  118.  
  119. program allows you to print up to 80
  120.  
  121. characters to track 10, sector 15.
  122.  
  123. Please do not run this program on a
  124.  
  125. LOADSTAR disk unless you are willing
  126.  
  127. to lose its contents. This program MAY
  128.  
  129. write over other data on the disk that
  130.  
  131. is needed.  Try the program on a new,
  132.  
  133. formatted disk.
  134.  
  135.   The second program reads track 10,
  136.  
  137. sector 15 and then asks you for a
  138.  
  139. PASSWORD.  The program then compares
  140.  
  141. what the user types in with what
  142.  
  143. appears on track 10, sector 15.  Using
  144.  
  145. this technique, you can put in some
  146.  
  147. protection for any of your programs.
  148.  
  149.  
  150.   The program to write on the disk
  151.  
  152. is named 'WRITE' and the program to
  153.  
  154. check the pass-word is called 'READ'.
  155.  
  156. They are both on SIDE 2 of LOADSTAR
  157.  
  158. NUMBER 7.
  159.  
  160.   Hope you have learned something from
  161.  
  162. all of this.  Go out and have fun.
  163.  
  164. --------------------------------------
  165.